package com.heihei.itextdemo.service.impl;

import com.heihei.itextdemo.dto.CommonResponseDTO;
import com.heihei.itextdemo.entity.HumanEntity;
import com.heihei.itextdemo.mapper.HumanMapper;
import com.heihei.itextdemo.service.HumanService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heihei.itextdemo.util.CommonUtil;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 人物 服务实现类
 * </p>
 *
 * @author duanhengfei
 * @since 2020-12-04
 */
@Service
public class HumanServiceImpl extends ServiceImpl<HumanMapper, HumanEntity> implements HumanService {

    /**
     * 添加
     */
    @Override
    public CommonResponseDTO<String> add(HumanEntity entity) {
        //生成id
        entity.setId(CommonUtil.genUUID());
        boolean save = save(entity);
        if(save) {
            return CommonResponseDTO.forSuccess();
        }
        return CommonResponseDTO.forFail();
    }
}
